package de.fstyle.android.worldcanvas.fragments;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;

import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

public class MySupportMapFragment extends SupportMapFragment {

	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		
		super.onViewCreated(view, savedInstanceState);
		
		this.getMap().setMyLocationEnabled(true);
		
		this.getMap().addMarker(
				new MarkerOptions().position(new LatLng(0, 0)).title("Hello world"));
		
		Bitmap.Config conf = Bitmap.Config.ARGB_8888;
		Bitmap bmp = Bitmap.createBitmap(80, 80, conf);
		Canvas canvas1 = new Canvas(bmp);

		// paint defines the text color, stroke width, size
		Paint color = new Paint();
		color.setTextSize(35);
		color.setColor(Color.BLACK);

		//modify canvas
		canvas1.drawCircle(40, 40, 40, color);
		
		LatLng MELBOURNE = new LatLng(10, 10);
		this.getMap().addMarker(
				new MarkerOptions()
					.position(MELBOURNE)
					.draggable(true)
					.anchor(.5f, .5f)
					.title("Melbourne")
					.snippet("Population: 4,137,400")
					.icon(BitmapDescriptorFactory.fromBitmap(bmp)));
	}
}